<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		window.onload=function(){	
			//作业1
//		let str=new String("abcdefgasdfabcfdasdfadf")
//		document.writeln(str.replace(/abc/g,"999"))//把replace的第一个参数换成正则式

			
			//知识点{
			let str=new String("abcdefgasdfabcfdasdfadcf")
			document.writeln(str.indexOf("abc",3))
			}
			let str="aabcsdfabcgfhabcgj"
			let target= "abc"
			let index= 0
			//作业1：找出所有"abc"的下标
			while(str.indexOf(target,index) != -1){
				console.log(str.indexOf(target,index))
				index=str.indexOf(target,index)+1
			}
			//作业二：替换所有"abc"
			while(str.indexOf(target,index) != -1){
				str=str.replace(target,"###")
			}
			console.dir(str)
		}
	</script>
</html>
